#include <iostream>

using namespace std;

int main(){
	unsigned short d;
	cin >> d;
	while(d--){
		unsigned int n,p=0;
		cin >> n;
		if (!n){
			cout << n << " " <<  p << endl;
			continue;
		}
		while(!(n&1)){
			n=n>>1;
			p++;
		}
		if (!n) n=1;
		cout << n << " " << p << endl;
	}
}
